import java.util.Scanner;

/**
 * Redraiment是走梅花桩的高手。Redraiment可以选择任意一个起点，从前到后，但只能从低处往高处的桩子走。他希望走的步数最多，你能替Redraiment研究他最多走的步数吗？
 */
public class Redraiment {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String s = scanner.nextLine();
            int n = Integer.parseInt(s);
            int[] nums = new int[n];
            for (int i = 0; i < n; i++) {
                nums[i] = scanner.nextInt();
            }
            int[] dp = new int[n];
            for (int i = 0; i < n; i++) {
                dp[i] = 1;
            }
            int max = 0;
            for (int i = 1; i < n; i++) {
                for (int j = 0; j < i; j++) {
                    if(nums[i] > nums[j]){
                        dp[i] = Math.max(dp[i],dp[j]+1);
                    }
                    if(dp[i] > max){
                        max = dp[i];
                    }
                }
            }
            System.out.println(max);
        }
    }
}
